using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Admin.Data;

using AttendConfigTable = CentralOffice.Admin.Data.AttendConfig.Attend_ConfigDataTable;
using AttendConfigRow = CentralOffice.Admin.Data.AttendConfig.Attend_ConfigRow;

namespace CentralOffice.Admin.DataAccess
{
    public class AttendConfigAdapter : DataAccessAdapter<AttendConfig, AttendConfigTable, AttendConfigRow>
    {
        public AttendConfigAdapter()
        {
            this.TableName = "Attend_Config";
            GetAllStoredProc = "Admin.Attend_SelectAttendAll";
            InsertStoredProc = "Admin.Attend_InsertAttend";
            UpdateStoredProc = "Admin.Attend_UpdateAttend";
            DeleteStoredProc = "Admin.Attend_DeleteAttend";
            FindStoredProc = "Admin.Attend_SelectAttendDynamic";
            GetByIdStoredProc = "Admin.Attend_SelectAttend";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            //db.AddInParameter(cmd, "DutyTypeId", DbType.Int32, "DutyTypeId", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyName", DbType.String,"DutyName", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "General", DbType.String, "General", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime1", DbType.String, "DutyTime1", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime2", DbType.String, "DutyTime2", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime3", DbType.String, "DutyTime3", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime4", DbType.String, "DutyTime4", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime5", DbType.String, "DutyTime5", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyTime6", DbType.String, "DutyTime6", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType1", DbType.Int32, "DutyType1", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType2", DbType.Int32, "DutyType2", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType3", DbType.Int32, "DutyType3", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType4", DbType.Int32, "DutyType4", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType5", DbType.Int32, "DutyType5", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "DutyType6", DbType.Int32, "DutyType6", System.Data.DataRowVersion.Current);
        }

        protected override void PopulateUpdateParameters(Database db, DbCommand cmd)
        {
            //base.PopulateUpdateParameters(db, cmd);
            db.AddInParameter(cmd, "Id", DbType.Int32, "DutyTypeId",System.Data.DataRowVersion.Current);
            PopulateInsertParameters(db, cmd);
        }
    }
}
